package com.study.agp.paging;

import androidx.lifecycle.LiveData;
import androidx.lifecycle.ViewModel;
import androidx.paging.LivePagedListBuilder;
import androidx.paging.PagedList;

public class MovieViewModel extends ViewModel {
    public final LiveData<PagedList<Movie>> moviePagedList;

    public MovieViewModel() {
        PagedList.Config config = new PagedList.Config.Builder()
                .setEnablePlaceholders(true)
                .setPageSize(8)
                .setPrefetchDistance(3)
                .setInitialLoadSizeHint(8 * 3)
                .setMaxSize(8 * 100)
                .build();
        moviePagedList = new LivePagedListBuilder<>(new MovieDataSourceFactory(), config).build();
    }
}
